<!DOCTYPE html>
<html>
<meta charset="UTF-8">
<title>Insert title here</title>
    <!-- 新 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css">

<!-- 可选的Bootstrap主题文件（一般不用引入） -->
<link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">

<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<script src="//cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>

<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="//cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>

</head>
<body>
<div>
<br></br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<button type="submit" class="addAd">添加管理员</button>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<button type="submit" class="getMerc">商家审核</button>
</div>
<br></br>
	<table id="stus" class="table table-striped  table-hover">
    	<tr><th>id</th><th>name</th><th>phone</th><th>imag</th><th>price</th><th>assess</th><th>address</th><th>temps</th><th>manage</th></tr>
    </table>
<script>
    var stus=$("#stus");
   $(".getMerc").click(function(){
	$.ajax("getMerchants",{
      method:"POST",
      dataType:"json",
      success:function(d){   
    	for(i=0;i<d.length;i++){
      	  $("<tr></tr>").append($("<td></td>").text(d[i].mid))
          .append($("<td></td>").text(d[i].mname))
          .append($("<td></td>").text(d[i].mphone))
          .append($("<td></td>").text(d[i].mimage))
            .append($("<td></td>").text(d[i].sendprice))
              .append($("<td></td>").text(d[i].assess))
                .append($("<td></td>").text(d[i].maddress))
                 .append($("<td></td>").text(d[i].temp))
                
               .append($('<td><button  id="wd" onclick="del(this)"  class="del">删除 </button> <input type="button" id="test" value="未受理" onclick="changeValue(this)"/></td>'))
                
          .appendTo(stus);
      	}	
      
      }
  });
});
   function del(btn){
   	var tr=btn.parentElement.parentElement;    	
   	var id=tr.cells[0].innerHTML;    	
   	tr.remove();
   	var data={id:id}
   	$.ajax("deleteMerch",{
   		method:"post",
   		type:"json",
   		data:data
   	});
   }
   
   
   function changeValue(obj)
   {
    if(obj.value=="未受理")
    {
    obj.value="已受理";
   alert("成功受理");
    document.getElementById("test").disabled = true;
    }
    else
    {
    obj.value="未受理";
    }
    var tr=obj.parentElement.parentElement;    	
	var id=tr.cells[0].innerHTML;     	
	//alert(id);
	var data={id:id};
	$.ajax("accMer",{
		method:"post",
		type:"json",
		data:data
	});
   }
   
   
   
   
  
	    $(".addAd").click(function () {
	        location.href = "addAdmins.html";
	    });


</script>


</body>
</html>